<template>
  <common_print_dialog ref="common_print_dialog" businessType="PARCEL" v-bind="$attrs" v-on="$listeners" :tableModel="[
    { key: 'packageNo', label: 'label_package_code', 'min-width': 120, 'show-overflow-tooltip': true, },
    {
      key: 'destinationWarehouseName', label: 'label_destination_warehouse', 'width': 120, 'show-overflow-tooltip': true,
      formatter: (r, c, v, i) => this.$formatNameCode(v, r.destinationWarehouseCode)
    },
    { key: 'boxQty', label: '装箱数量', 'width': 100, 'show-overflow-tooltip': true, },
  ]" printUrl="/wms-api/inbound/WmsInboundTransitPackagingRpc/print.json" :printHandler="(data, list) => {
  return {
    clientName: data.clientName,
    printerName: data.printerName,
    printDetailList: list.map(it => {
      return {
        printType: data.type,
        templateId: data.templateId,
        printNum: data.printNumSum,
        fileType: data.fileType,
        packageNo: it.packageNo,
        binNum: it.boxQty,
        targetWarehouse: it.destinationWarehouseName,
        isFixed: it.inboundOrderCodeList && it.inboundOrderCodeList.length > 1 ? '混箱' : ' ',
        inboundOrderCodeList: it.inboundOrderCodeList,
      }
    })
  }
}" previewUrl="/wms-api/inbound/WmsInboundTransitPackagingRpc/preview.json" :previewHandler="(data, row) => {
  data.printType = data.type
  data.packageNo = row.packageNo
  data.binNum = row.boxQty
  data.targetWarehouse = row.destinationWarehouseName
  data.isFixed = row.inboundOrderCodeList && row.inboundOrderCodeList.length > 1 ? '混箱' : ' '
  data.inboundOrderCodeList = row.inboundOrderCodeList ? row.inboundOrderCodeList.join(',') : ''
  return data
}" />
</template>

<script>
import common_print_dialog from './common_print_dialog.vue'

export default {
  components: { common_print_dialog },
  data() {
    return {

    }
  },
  props: {
  },
  methods: {
    show(rows) {
      this.$refs.common_print_dialog.show(rows)
    },



  }
}
</script>
